/*
 * bsp_pwm.c
 *
 *  Created on: 2025年4月8日
 *      Author: 22332
 */
#include "cola_init.h"
#include "cola_device.h"
#include "drv_pwm.h"

static cola_device_t g_dev_pwm;

static int bsp_pwm_open(cola_device_t *dev, int oflag){
	(void)dev;
	(void)oflag;
	bsp_drv_pwm_init();
	return 0;
}

static int bsp_pwm_close(cola_device_t *dev){
	(void)dev;
	bsp_drv_pwm_deinit();
    return 0;
}


static int bsp_pwm_write(cola_device_t *dev, int pos, const void *buffer, int size){
	(void)dev;
	(void)buffer;
	(void)size;
	bsp_drv_change_duty(pos);
    return 0;
}






static struct cola_device_ops master_pwm_Ops ={
    .open   = bsp_pwm_open,
    .close  = bsp_pwm_close,
    .write = bsp_pwm_write,
};

static void bsp_pwm_configuration(void){
	g_dev_pwm.name = "DEVICE_PWM";
	g_dev_pwm.dops = &master_pwm_Ops;
    cola_device_register(&g_dev_pwm);
}
register_initcall(bsp_pwm_configuration);

